//START
//EListenCanvas start
if(typeof TOOLS ==="undefind"){
	var TOOLS =function(){}
	}
;(function(){
    var EListenCanvas = function(canvasid,w,h,bl){
		if(typeof w ==='undefined'){
		    w = 0 ;
			h = 0 ;	
		}
		this.type = 'resize';
		this.method = function(){
			if(typeof bl==='undefined'){
		    document.getElementById(canvasid).width  = window.innerWidth-w;
		    document.getElementById(canvasid).height = window.innerHeight-1-h;	
			console.log(document.getElementById(canvasid).width)
			}else{
			document.getElementById(canvasid).style.width  
			=parseInt(window.innerWidth*w)+'px' 
		   // document.getElementById(canvasid).style.height
		   // =parseInt(window.innerHeight*h)-1+'px'	
			console.log(document.getElementById(canvasid).style.width )					
			}
		}
		this.useCapture = false;
		this.add();		
		}  
		EListenCanvas.prototype.add=function(){
		    window.addEventListener( this.type, this.method, this.useCapture );	
			var themethod = this.method;
			EListenCanvas.ready(function(){
			   themethod()		
		    }) 
						
		}
		EListenCanvas.ready=function(callback){
	if(document.addEventListener){
		document.addEventListener(
		    "DOMContentLoaded",
		    function(){
			    document.removeEventListener("DOMContentLoaded",arguments.callee,false);
			    callback();
				console.log('-removeEventListener');
		    },
			false
		);
	}else if(document.attachEvent){
		document.attachEvent(
		    "onreadystatechange",
		    function(){
			    if ( document.readyState === "complete" ) {
				    document.detachEvent( "onreadystatechange", arguments.callee );
				    callback();
					console.log('-detachEvent');
			    }
		    }
		)
	 }
   }	
   window.EListenCanvas=TOOLS.EListenCanvas=EListenCanvas;	 
})()
//EListenCanvas end
//END
//var o={name:'koolfer'}
//var xxx=function(){
//	
//	
//	alert(this.name)
//	}.__$bind$__(o)
//	
//	xxx()
//	
//	//